//
//  JYTFinishCarViewController.m
//  JYT_IOS
//
//  Created by nxa-chengjinhui on 2017/1/10.
//  Copyright © 2017年 nxa-yuanguoxiang. All rights reserved.
//

#import "JYTFinishCarViewController.h"
#import "JYTRecondDetailViewController.h"
#define HEADHEIGHT 240
@interface JYTFinishCarViewController ()

@end

@implementation JYTFinishCarViewController
-(instancetype)initWithState:(NSString *)state{
    if (self = [super init]) {
        self.paystate = state;
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    NSDictionary *dic = @{@"lftBtnBgImg":@"ic_goback",
                          @"lftBtnTitle":@"no",
                          @"pageTitle":@"学车结束",
                          @"rhtBtnBgImg":@"no",
                          @"rhtBtnTitle":@"no"};
    
    [self setNavgationBarWithDic:dic];

    MyLog(@"self.paystate====%@",self.paystate);
    
    //学车详情
    [self learCarDetail];
    //评价  评论  支付
    [self footview];
}
//学车教练详情
-(void)learCarDetail{
    
    UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 64, CURRENT_SCREEN_WIDTH, HEADHEIGHT)];
//    headView.backgroundColor = [UIColor greenColor];
    [self.view addSubview:headView];
    
    //学车日期
    UILabel *dateLab = [[UILabel alloc] initWithFrame:CGRectMake(20, 10, CURRENT_SCREEN_WIDTH/2, 30)];
    dateLab.text = [NSString stringWithFormat:@"学车日期：%@",@"2017-1-1"];
    dateLab.font = [UIFont systemFontOfSize:16];
    dateLab.adjustsFontSizeToFitWidth = YES;
    [headView addSubview:dateLab];
    
    //头像
    UIImageView *imgview = [[UIImageView alloc] initWithFrame:CGRectMake(20, CGRectGetMaxY(dateLab.frame)+10, CURRENT_SCREEN_WIDTH/5, CURRENT_SCREEN_WIDTH/5)];
    [imgview sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:[UIImage imageNamed:@"tx_w"]];
    [headView addSubview:imgview];
    
    //教练  驾校  科目
    UILabel *nameLable = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(imgview.frame)+20, CGRectGetMaxY(dateLab.frame)+10, CURRENT_SCREEN_WIDTH/5, HEADHEIGHT/3)];
    nameLable.text = [NSString stringWithFormat:@"%@\n\n%@\n\n%@",@"张三丰",@"能士驾校",@"科目二"];
    nameLable.font = [UIFont systemFontOfSize:12];
    nameLable.numberOfLines = 0;
    nameLable.lineBreakMode = NSLineBreakByWordWrapping;
    [headView addSubview:nameLable];
    //点赞
    UIView *bestView = [[UIView alloc] initWithFrame:CGRectMake(CURRENT_SCREEN_WIDTH-100, nameLable.frame.origin.y, 80, 20)];
    [headView addSubview:bestView];
    
    for (int i=0; i<5; i++) {
        UIImageView *starImg = [[UIImageView alloc] initWithFrame:CGRectMake(5+15*i, 2, 15, 15)];
        starImg.image = [UIImage imageNamed:@"02驾校查询_29"];
        [bestView addSubview:starImg];
        
        if (i<3) {//根据星级来显示星星
            starImg.image = [UIImage imageNamed:@"02驾校查询_27"];
        }
    }
    
    //学车费用
    UILabel *moenyLab = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(imgview.frame)+20, CURRENT_SCREEN_WIDTH, 30)];
    moenyLab.textAlignment = NSTextAlignmentCenter;
    moenyLab.text = @"学车费用";
//    moenyLab.textColor = kColor(241, 241, 241);
    moenyLab.font = [UIFont boldSystemFontOfSize:16];
    moenyLab.textColor = [UIColor redColor];
    [headView addSubview:moenyLab];
    
    UIView *line1 = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(imgview.frame)+20+15, CURRENT_SCREEN_WIDTH/2-40, 1.5)];
    line1.backgroundColor = [UIColor redColor];
    [headView addSubview:line1];
    
    UIView *line2 = [[UIView alloc] initWithFrame:CGRectMake(CURRENT_SCREEN_WIDTH-(CURRENT_SCREEN_WIDTH/2-40), CGRectGetMaxY(imgview.frame)+20+15, CURRENT_SCREEN_WIDTH/2-40, 1.5)];
    line2.backgroundColor = [UIColor redColor];
    [headView addSubview:line2];
    
    UILabel *moenyLab1 = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(moenyLab.frame), CURRENT_SCREEN_WIDTH, 30)];
    moenyLab1.textAlignment = NSTextAlignmentCenter;
    moenyLab1.font = [UIFont systemFontOfSize:16];
    moenyLab1.text = [NSString stringWithFormat:@"共：¥%@",@"260"];
    [headView addSubview:moenyLab1];
    
    UIButton *lookDetailBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    lookDetailBtn.frame = CGRectMake(0, CGRectGetMaxY(moenyLab1.frame)+15, CURRENT_SCREEN_WIDTH/3, 30);
    lookDetailBtn.center = CGPointMake(CURRENT_SCREEN_WIDTH/2, CGRectGetMaxY(moenyLab1.frame)+10);
    [lookDetailBtn setTitle:@"查看明细" forState:UIControlStateNormal];
    [lookDetailBtn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
//    lookDetailBtn.backgroundColor = [UIColor redColor];
    lookDetailBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [lookDetailBtn addTarget:self action:@selector(lookDetailClicked) forControlEvents:UIControlEventTouchUpInside];
    [headView addSubview:lookDetailBtn];
    
    //分割线
    UIView *line3 = [[UIView alloc] initWithFrame:CGRectMake(0, headView.frame.size.height-1, CURRENT_SCREEN_WIDTH, 1)];
    line3.backgroundColor = [UIColor grayColor];
    [headView addSubview:line3];
}

-(void)footview{
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, HEADHEIGHT+64, CURRENT_SCREEN_WIDTH, CURRENT_SCREEN_HEIGHT-64 - HEADHEIGHT)];
//    view.backgroundColor = [UIColor redColor];
    [self.view addSubview:view];
    
    
    
}
-(void)lookDetailClicked{
    [self pushViewController:[[JYTRecondDetailViewController alloc] init]];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
